package jeye.listeners.db;


import org.springframework.beans.factory.annotation.Autowired;

import jeye.dao.EventDAO;
import jeye.events.MotionDetectionEvent;
import jeye.listeners.MotionDetectionListener;

public class MotionDetectionStartListener implements MotionDetectionListener {
	
	@Autowired
	private EventDAO eventDAO;

	public void onMotionDetection(MotionDetectionEvent motionDetectionEvent) {
		long eventId = eventDAO.saveMotionDetectionEvent(motionDetectionEvent.getTimestamp(), motionDetectionEvent.getFramerate());
		System.out.println("INSERTED EVENT_ID: " + eventId);
		motionDetectionEvent.setId(eventId);
	}

}
